#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e5 + 5;

int n, m;
int tr[N << 5][2], tot;
void insert(int x) {
  int p = 0;
  per(i, 30, 0) {
    int v = x & (1 << i);
    int ch = v ? 1 : 0;
    if (!tr[p][ch]) tr[p][ch] = ++tot;
    p = tr[p][ch];
  }
}
int query(int x) {
  int p = 0, ans = 0;
  per(i, 30, 0) {
    int v = x & (1 << i);
    int ch = v ? 0 : 1;
    if (tr[p][ch])
      ans |= 1 << i;
    else
      ch ^= 1;
    p = tr[p][ch];
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  int ans = 0;
  rep(i, 1, n) {
    int x;
    cin >> x;
    insert(x);
    ans = max(ans, query(x));
  }
  cout << ans;
  return 0;
}